@extends('layouts.admin')
@section('title')
    <title>hair编辑</title>
@endsection
@section('content')
    @include('layouts.left')
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
               hair编辑
                <small>Control panel</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                <li class="active">Dashboard</li>
            </ol>
        </section>
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-offset-2 col-md-8">
                    @if(session('info'))
                        <div class="alert alert-warning alert-dismissible">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            <h4><i class="icon fa fa-warning"></i> Alert!</h4>
                            {{ session('info') }}
                        </div>
                    @endif
                    @if(count($errors)>0)
                        <div class="alert alert-danger alert-dismissible">
                            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
                            <h4><i class="icon fa fa-ban"></i> 警告</h4>
                            <ul>
                                @foreach($errors -> all() as $error)
                                    <li >{{ $error }}</li>
                                @endforeach
                            </ul>
                        </div>
                @endif
                <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">快速编辑</h3>
                        </div>
                        <!-- /.box-header -->
                        <!-- form start -->
                        <form  action="{{ url('hair') }}/{{$datas['hairid']}}" method="post" enctype="multipart/form-data">
                            {{ csrf_field() }}
                            <input type="hidden" name="_method" value="PUT">
                            <div class="box-body">
                                <div class="form-group">
                                    <label for="exampleInputEmail1">名称</label>
                                    <input type="text" class="form-control"  required value="{{ $datas['hairname'] }}" name="hairname"   >
                                </div>
                                <div class="form-group">
                                    <label>类型</label>
                                    <select class="form-control hairtype" name="hairtype" >
                                        <option value="1">Long</option>
                                        <option value="2">Short</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>sex</label>
                                    <select class="form-control hairsex" name="hairsex" >
                                        <option value="1">women</option>
                                        <option value="2">men</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">宽</label>
                                    <input type="text" class="form-control"  required value="{{ $datas['hairwidth'] }}" name="hairwidth"   >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">高</label>
                                    <input type="text" class="form-control"  required value="{{ $datas['hairheight'] }}" name="hairheight"   >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">leftx</label>
                                    <input type="text" class="form-control"  required value="{{ $datas['leftx'] }}" name="leftx"   >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">lefty</label>
                                    <input type="text" class="form-control"  required value="{{ $datas['lefty'] }}" name="lefty"   >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">rightx</label>
                                    <input type="text" class="form-control"  required value="{{ $datas['rightx'] }}" name="rightx"   >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">righty</label>
                                    <input type="text" class="form-control"  required value="{{ $datas['righty'] }}" name="righty"   >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">排序</label>
                                    <input type="text" class="form-control"  required value="{{ $datas['sort'] }}" name="sort"   >
                                </div>
                                <div class="form-group">
                                    <label>状态</label>
                                    <select class="form-control status" name="status" >
                                        <option value="0">禁用</option>
                                        <option value="1">正常</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">缩略图</label>
                                    <span><img src="http://img1.shishikeji.cn/{{$datas['hairthumb']}}"></span>
                                </div>
                                {{--将老地址隐藏传递；为了删除七牛数据--}}
                                <input type="hidden" value="{{$datas['hairthumb']}}" name="hairthumb">
                                <div class="form-group">
                                    <label for="exampleInputEmail1">替换缩略图（不替换不用填写）</label>
                                    <input type="file" class="form-control"  name="file"   >
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">缩略像素宽:默认110</label>
                                    <input type="text" class="form-control"  name="thumbwidth" value="110">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">缩略像素高:默认110</label>
                                    <input type="text" class="form-control"  name="thumbheight" value="110">
                                </div>
                            </div>
                            <!-- /.box-body -->
                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">更新</button>
                            </div>
                        </form>
                    </div>
                    <!-- /.box -->
                </div>
                <!--/.col (left) -->
            </div>
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <!-- /.书写js-->
    <script type="text/javascript">
        $(".hairstyle").val({{$datas['hairstyle']}});
        $(".hairsex").val({{$datas['hairsex']}});
        $(".status").val({{$datas['status']}});
    </script>
@endsection


